#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
int main(int argc, const char *argv[])
{
	int fd=open("./3.txt",O_RDWR|O_CREAT,0664);
	if(-1==fd)
	{
		perror("open:");
	}
	
		
	char buf[32]={0};
	char readbuf[32]={0};
	scanf("%s",buf);
	printf("%s\n",buf);
	if(-1==write(fd,buf,strlen(buf)))
	{
		perror("write:");
	}
	lseek(fd,0,SEEK_SET);
	read(fd,readbuf,sizeof(readbuf));

	printf("%s\n",readbuf);

	
	return 0;
}
